#include "headers/Fonts.h"

#include <SDL/SDL.h>
#include <SDL/SDL_ttf.h>

extern SDL_Surface *screen;
TTF_Font* font;


int InitText() {
    
    TTF_Init ();
    font = TTF_OpenFont("Balcony Angels.ttf", 18);
    TTF_SetFontStyle (font, TTF_STYLE_NORMAL);
    
}


int OutText(const char* txt, int x, int y) {
    
    SDL_Color fg = {255,255,255,0};
    SDL_Surface *Text = TTF_RenderText_Solid(font, txt, fg);
    
    SDL_Rect dest;
    dest.x = x;
    dest.y = y;
    SDL_BlitSurface(Text, NULL, screen, &dest);
    
    SDL_FreeSurface(Text);
    
}

int SetFont(const char* name, int size) {
    
    TTF_CloseFont(font);
    font = TTF_OpenFont(name, 18);
    TTF_SetFontStyle (font, TTF_STYLE_NORMAL);
    
}

int DeinitText() {
    
    TTF_CloseFont(font);
    
}
